//package com.amigo.online.provider.search.rocketmq.consumer;
//
//import java.io.IOException;
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//import java.util.Set;
//
//import javax.annotation.Resource;
//
//import org.apache.solr.client.solrj.SolrClient;
//import org.apache.solr.client.solrj.SolrServerException;
//import org.apache.solr.common.SolrInputDocument;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.stereotype.Component;
//
//import com.amigo.online.provider.search.rocketmq.PushMessage;
//import com.amigo.online.provider.search.rocketmq.model.BaseMqSendModel;
//
//@Component("UserUpdateToSolrConsumer")
//@SuppressWarnings("unchecked")
//public class UserPartialUpdateToSolrComsumer implements PushMessage {
//
//	private static final Logger logger =  LoggerFactory.getLogger(VideoPartialUpdateToSolrConsumer.class);
//
//	@Resource(name = "SolrClient_user")
//	private SolrClient solrClient_user;
//
//	@Override
//	public void handleMessage(BaseMqSendModel baseMqSendModel){
//		Map<String, String> map = baseMqSendModel.getSendContentBean(Map.class);
//		List<SolrInputDocument> videoDocument = new ArrayList<SolrInputDocument>();
//		SolrInputDocument document = new SolrInputDocument();
//		document.addField("id", map.get("id"));
//		map.remove("id");
//		Set<String> keySet = map.keySet();
//		for (String key : keySet) {
//			Map<String, Object> partialUpdate = new HashMap<>();
//			partialUpdate.put("set", map.get(key));
//			document.addField(key, partialUpdate);
//		}
//		document.addField("_version_", 1);
//		videoDocument.add(document);		
//		try {
//			solrClient_user.add(videoDocument);
//			solrClient_user.commit();
//		} catch (SolrServerException | IOException e1) {
//			logger.error("同步solr 用户信息报错!同步的信息为:" + map.toString());		
//		}	
//	}
//}
